<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import = "com.project.model.Food"%>
<%@ page import = "com.project.control.FoodControl"%>
<%@ page import = "com.project.control.DateControl"%>
<%@page import="com.project.util.ParamUtil"%>
<%@ include file="../login/login_check.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>食</title>	
    <style type="text/css">
	.box{
		width:650px;
		height:800px;
	}
	</style>
  </head>
  
<body>

<div class="box">
  <form>
 <strong style="background-image:url(../../../resources/images/subtitle_box.jpg); width:80px; height:30px; line-height:30px; text-align:center;font-family:微软雅黑,宋体; font-weight:bold">文章管理</strong>
  <p></p>
 <table border="0" cellpadding="0">
 <thead>
  <tr style="font-family:微软雅黑,宋体; font-weight:bold; font-size:14px; background-image:url(../../../resources/images/subtitle_box.jpg)">
  		<th width="100" height="25">编号</th>
  		<th width="150">标题</th>
  		<th width="150">转贴自</th>
  		<th width="300">日期</th>
  		<th width="100">作者</th>
  		<th width="250">类型</th>
  		<th width="200">点击数</th>
  		<th width="100">操作</th>
  		<th width="100">操作</th>
  </tr>
</thead>	
<tbody>
  <%
  request.setCharacterEncoding("UTF-8");
  session.removeAttribute("objectid");
  int pages=ParamUtil.getInt(request,"pages",0);
  int rowsPerpage=ParamUtil.getInt(request,"pageSize",10);
  FoodControl hc=new FoodControl();
  Food food=new Food();
  List<Food>list1=new ArrayList<Food>();
  list1 = (List) hc.GetFood(pages,rowsPerpage,"addtime");
  for(int i=0;i<list1.size();i++)
{
food = list1.get(i);%>
<tr height="30px" style="font-family:微软雅黑,宋体; font-size:12px">
 		<td align = center><%=food.getId()%></td>
 		<td align = center><a href = "readme.jsp?id=<%=food.getId()%>"><%if(food.getTitle().length()>15){out.print(food.getTitle().substring(0,20)+ "...");} else out.print(food.getTitle()); %></a></td>
 		<td align="center"><%=food.getOriginal()%></td>
 		<td align = center><%=food.getAddtime()%></td>
 		<td align=center><%=food.getEditor() %></td>
 		<td align=center >
				<%
					if(food.getType()==0) out.println("东师食堂");
					else if(food.getType()==1)
					out.println("食物搭配");
					else if(food.getType()==2)
					out.println("食物禁忌");
				%>
		</td>
 		<td align="center"><%=food.getClicks()%></td>         
        <td align = center><a href = "food_update.jsp?id=<%=food.getId()%>">修改</a></td>
		<td align = center><a href = "food_delete.jsp?id=<%=food.getId()%>" onclick = 'return confirm("确定要删除吗?")'>删除</a></td>
</tr>
 	<% 		
}   %>
		</tbody>
</table>
<div style="text-align:center;font-family:微软雅黑,宋体; font-size:12px">
 	  <%
			out.println(FoodControl.pageInstance.getToolsMenu(pages));
	  %>
</div>
	  </form>
	  <input type = "button" value = "添加动态"
	  	onclick="window.location.href='food_add.jsp'" style="font-family:微软雅黑,宋体; font-size:12px" />	
</div>
  </body>
</html>

